package com.example.weather.util

import com.example.library_room.db.UserDB
import com.example.weather.data.UserModel
import com.google.gson.Gson

object BeanUtils {

    //把UserModel中数据转换成UserDB的存储数据
    fun userToUserDB(user: UserModel?): UserDB {
        val json = Gson()
        val jsonStr = json.toJson(user)
        return json.fromJson(jsonStr, UserDB::class.java)
    }
}